﻿using DAEProde.Domain;
using DAEProde.Tasks.ViewModels;
using SharpLite.Domain.DataInterfaces;
using System.Linq;

namespace DAEProde.Tasks
{
    public class TicketCudTasks : BaseEntityCudTasks<Ticket, EditTicketViewModel>
    {
        public TicketCudTasks(IRepository<Ticket> ticketRepository)
            : base(ticketRepository) { }

        protected override void TransferFormValuesTo(Ticket toUpdate, Ticket fromForm)
        {
            toUpdate.MatchDateScore = fromForm.MatchDateScore;

            toUpdate.Predictions.Clear();

            foreach (var predition in fromForm.Predictions)
            {
                toUpdate.Predictions.Add(predition);
            }
        }
    }
}
